function recharge(){}
recharge.prototype={

	tocharge:function(){
		var check_rs=this.check();
		if(!check_rs) return false;
		$.get("index.php?c=index&a=tocharge",check_rs,function(rs){
			rs=eval("("+rs+")");
			if(rs.recode=="1"){
				top.location.href=rs.rs;
			}
			else{
				switch(rs.rs){
					case "wrong_pass":
						alert("支付密码错误");
						break;
				}
			}
		});
	},

	check:function(){
		var charge_sum=$("#charge_sum").val();
		var sub_pat=/\d+/;
		if(!sub_pat.test(charge_sum)||parseInt(charge_sum)<=0){alert("金额填写有误");return false;}
		var pay_type=$("input:checked[name=pay_type]").val();
		if(!pay_type) {alert("请选择支付方式");return false;}
		var pass=$("#pay_pass").val();
		if(!pass){alert("请填写支付密码");return false;}
		return {sum:charge_sum,pay_type:pay_type,pass:pass};
	}

}

$(document).ready(function(){
	var charge_obj=new recharge();
	$("#submit_charge").click(function(){
		charge_obj.tocharge();
	});

	$(".cont-tab a").click(function(){
		var i=$(this).index()+1;
		$(this).addClass("cur").siblings("a").removeClass("cur");
		$("#payment"+i).removeClass("fn-hide").siblings("ul").addClass("fn-hide");

	});
});